<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Lin_Loader extends CI_Loader
	{
		
		function __construct()
		{
			parent::__construct();
		}
		
		
		/**
		 * 
		 * 设置视图路径
		 * @param unknown_type $switcher
		 * @param unknown_type $theme
		 * @param unknown_type $path
		 */
		function switch_theme($switcher = 'on' , $theme = 'default' ,$path = 'template'){
			
			if($switcher == 'on')
			{
				$this->_ci_view_paths = array(FCPATH.$path.'/'.$theme.'/'	=> TRUE);
			}
			
		}



		/**
		 * 
		 * 调用自定义配置数据库 重写model
		 * @param unknown_type $model
		 * @param unknown_type $name
		 * @param unknown_type $db_conn
		 */
		public function _model($model, $name = '', $db_conn = FALSE){
			//载入数据库配置
			include FCPATH.'config/config'.EXT;
			$config['hostname'] = $db['hostname'];
			$config['username'] = $db['username'];
			$config['password'] = $db['password'];
			$config['database'] = $db['database'];
			$config['dbdriver'] = $db['dbdriver'];
			$config['dbprefix'] = $db['dbprefix'];
			$config['pconnect'] = $db['pconnect'];
			$config['db_debug'] = $db['db_debug'];
			$config['cache_on'] = $db['cache_on'];
			$config['cachedir'] = $db['cachedir'];
			$config['char_set'] = $db['char_set'];
			$config['dbcollat'] = $db['dbcollat'];
			$config['swap_pre'] = $db['swap_pre'];
			$config['autoinit'] = $db['autoinit'];
			$config['stricton'] = $db['stricton'];
			$this->model($model,$name,$config);
		}
		
			
}
